package org.bcos.contract.source;

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.Future;
import org.bcos.channel.client.TransactionSucCallback;
import org.bcos.web3j.abi.TypeReference;
import org.bcos.web3j.abi.datatypes.Function;
import org.bcos.web3j.abi.datatypes.StaticArray;
import org.bcos.web3j.abi.datatypes.Type;
import org.bcos.web3j.abi.datatypes.Utf8String;
import org.bcos.web3j.abi.datatypes.generated.Bytes1;
import org.bcos.web3j.abi.datatypes.generated.Bytes32;
import org.bcos.web3j.crypto.Credentials;
import org.bcos.web3j.crypto.EncryptType;
import org.bcos.web3j.protocol.Web3j;
import org.bcos.web3j.protocol.core.methods.response.TransactionReceipt;
import org.bcos.web3j.tx.Contract;
import org.bcos.web3j.tx.TransactionManager;

/**
 * Auto generated code.<br>
 * <strong>Do not modify!</strong><br>
 * Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>, or {@link org.bcos.web3j.codegen.SolidityFunctionWrapperGenerator} to update.
 *
 * <p>Generated with web3j version none.
 */
public final class StringTool extends Contract {
    private static String BINARY = "6060604052341561000c57fe5b5b610b088061001c6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063045ccf7b146100675780633a96fdd71461013257806346bdca9a146101e35780639201de5514610298578063cfb5192814610343575bfe5b341561006f57fe5b6100a960048080610800019060408060200260405190810160405280929190826040602002808284378201915050505050919050506103b9565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b6101cd600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506105b3565b6040518082815260200191505060405180910390f35b34156101eb57fe5b61027e600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610880565b604051808215151515815260200191505060405180910390f35b34156102a057fe5b6102ba600480803560001916906020019091905050610898565b6040518080602001828103825283818151815260200191508051906020019080838360008314610309575b805182526020831115610309576020820191506020810190506020830392506102e5565b505050905090810190601f1680156103355780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561034b57fe5b61039b600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610a83565b60405180826000191660001916815260200191505060405180910390f35b6103c1610ab4565b6103c9610ac8565b600060006103d5610ac8565b60406040518059106103e45750595b908082528060200260200182016040525b50935060009250600091505b60408210156104d25760007f010000000000000000000000000000000000000000000000000000000000000002868360408110151561043c57fe5b60200201517effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156104c457858260408110151561047857fe5b6020020151848481518110151561048b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350505b5b8180600101925050610401565b826040518059106104e05750595b908082528060200260200182016040525b509050600091505b828210156105a657838281518110151561050f57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818381518110151561056857fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b81806001019250506104f9565b8094505b50505050919050565b60006105bd610ac8565b6105c5610ac8565b600060008693508592508351915081835110156105e157825191505b600090505b818110156108265782818151811015156105fc57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916848281518110151561067757fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015610712577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9450610876565b828181518110151561072057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916848281518110151561079b57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611156108175760019450610876565b5b5b80806001019150506105e6565b825184511015610858577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9450610876565b82518451111561086b5760019450610876565b60009450610876565b5b5b5050505092915050565b6000600061088e84846105b3565b1490505b92915050565b6108a0610ab4565b6108a8610ac8565b6000600060006108b6610ac8565b60206040518059106108c55750595b908082528060200260200182016040525b50945060009350600092505b60208310156109a1578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156109935781858581518110151561095a57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b5b82806001019350506108e2565b836040518059106109af5750595b908082528060200260200182016040525b509050600092505b83831015610a755784838151811015156109de57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028184815181101515610a3757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b82806001019350506109c8565b8095505b5050505050919050565b6000610a8d610ac8565b829050600081511415610aa65760006001029150610aae565b602083015191505b50919050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820b530589099b3e1022dd63f81eb65ac69fa15487b79314fab6f9b831be29d583d0029";

    public static final String ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"bytes1[64]\"}],\"name\":\"byte64ToString\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_a\",\"type\":\"string\"},{\"name\":\"_b\",\"type\":\"string\"}],\"name\":\"compare\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_a\",\"type\":\"string\"},{\"name\":\"_b\",\"type\":\"string\"}],\"name\":\"equal\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"bytes32\"}],\"name\":\"bytes32ToString\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"source\",\"type\":\"string\"}],\"name\":\"stringToBytes32\",\"outputs\":[{\"name\":\"result\",\"type\":\"bytes32\"}],\"payable\":false,\"type\":\"function\"}]";

    private static String GUOMI_BINARY = "6060604052341561000c57fe5b5b610b088061001c6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e77b5fc14610067578063446a1fe1146101185780634ef4f309146101c3578063adc48fa114610239578063b372efc3146102ee575bfe5b341561006f57fe5b610102600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506103b9565b6040518082815260200191505060405180910390f35b341561012057fe5b61013a600480803560001916906020019091905050610686565b6040518080602001828103825283818151815260200191508051906020019080838360008314610189575b80518252602083111561018957602082019150602081019050602083039250610165565b505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101cb57fe5b61021b600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610871565b60405180826000191660001916815260200191505060405180910390f35b341561024157fe5b6102d4600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506108a2565b604051808215151515815260200191505060405180910390f35b34156102f657fe5b61033060048080610800019060408060200260405190810160405280929190826040602002808284378201915050505050919050506108ba565b604051808060200182810382528381815181526020019150805190602001908083836000831461037f575b80518252602083111561037f5760208201915060208101905060208303925061035b565b505050905090810190601f1680156103ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60006103c3610ab4565b6103cb610ab4565b600060008693508592508351915081835110156103e757825191505b600090505b8181101561062c57828181518110151561040257fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916848281518110151561047d57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015610518577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff945061067c565b828181518110151561052657fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191684828151811015156105a157fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916111561061d576001945061067c565b5b5b80806001019150506103ec565b82518451101561065e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff945061067c565b825184511115610671576001945061067c565b6000945061067c565b5b5b5050505092915050565b61068e610ac8565b610696610ab4565b6000600060006106a4610ab4565b60206040518059106106b35750595b908082528060200260200182016040525b50945060009350600092505b602083101561078f578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156107815781858581518110151561074857fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b5b82806001019350506106d0565b8360405180591061079d5750595b908082528060200260200182016040525b509050600092505b838310156108635784838151811015156107cc57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818481518110151561082557fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b82806001019350506107b6565b8095505b5050505050919050565b600061087b610ab4565b829050600081511415610894576000600102915061089c565b602083015191505b50919050565b600060006108b084846103b9565b1490505b92915050565b6108c2610ac8565b6108ca610ab4565b600060006108d6610ab4565b60406040518059106108e55750595b908082528060200260200182016040525b50935060009250600091505b60408210156109d35760007f010000000000000000000000000000000000000000000000000000000000000002868360408110151561093d57fe5b60200201517effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156109c557858260408110151561097957fe5b6020020151848481518110151561098c57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350505b5b8180600101925050610902565b826040518059106109e15750595b908082528060200260200182016040525b509050600091505b82821015610aa7578382815181101515610a1057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028183815181101515610a6957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b81806001019250506109fa565b8094505b50505050919050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a723058205b57f50292e9369466611a6064e251c5da7c569337a8b8495130b5d6c6312df10029";

    private StringTool(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, Boolean isInitByName) {
        super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit, isInitByName);
        if(EncryptType.encryptType == 1) super.setContractBinary(GUOMI_BINARY);
    }

    private StringTool(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, Boolean isInitByName) {
        super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit, isInitByName);
        if(EncryptType.encryptType == 1) super.setContractBinary(GUOMI_BINARY);
    }

    private StringTool(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit, false);
        if(EncryptType.encryptType == 1) super.setContractBinary(GUOMI_BINARY);
    }

    private StringTool(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit, false);
        if(EncryptType.encryptType == 1) super.setContractBinary(GUOMI_BINARY);
    }

    public Future<Utf8String> byte64ToString(StaticArray<Bytes1> x) {
        Function function = new Function("byte64ToString", 
                Arrays.<Type>asList(x), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        return executeCallSingleValueReturnAsync(function);
    }

    public Future<TransactionReceipt> compare(Utf8String _a, Utf8String _b) {
        Function function = new Function("compare", Arrays.<Type>asList(_a, _b), Collections.<TypeReference<?>>emptyList());
        return executeTransactionAsync(function);
    }

    public void compare(Utf8String _a, Utf8String _b, TransactionSucCallback callback) {
        Function function = new Function("compare", Arrays.<Type>asList(_a, _b), Collections.<TypeReference<?>>emptyList());
        executeTransactionAsync(function, callback);
    }

    public Future<TransactionReceipt> equal(Utf8String _a, Utf8String _b) {
        Function function = new Function("equal", Arrays.<Type>asList(_a, _b), Collections.<TypeReference<?>>emptyList());
        return executeTransactionAsync(function);
    }

    public void equal(Utf8String _a, Utf8String _b, TransactionSucCallback callback) {
        Function function = new Function("equal", Arrays.<Type>asList(_a, _b), Collections.<TypeReference<?>>emptyList());
        executeTransactionAsync(function, callback);
    }

    public Future<Utf8String> bytes32ToString(Bytes32 x) {
        Function function = new Function("bytes32ToString", 
                Arrays.<Type>asList(x), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}));
        return executeCallSingleValueReturnAsync(function);
    }

    public Future<TransactionReceipt> stringToBytes32(Utf8String source) {
        Function function = new Function("stringToBytes32", Arrays.<Type>asList(source), Collections.<TypeReference<?>>emptyList());
        return executeTransactionAsync(function);
    }

    public void stringToBytes32(Utf8String source, TransactionSucCallback callback) {
        Function function = new Function("stringToBytes32", Arrays.<Type>asList(source), Collections.<TypeReference<?>>emptyList());
        executeTransactionAsync(function, callback);
    }

    public static Future<StringTool> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
        if(EncryptType.encryptType == 1) setBinary(getGuomiBinary());
        return deployAsync(StringTool.class, web3j, credentials, gasPrice, gasLimit, BINARY, "", initialWeiValue);
    }

    public static Future<StringTool> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, BigInteger initialWeiValue) {
        if(EncryptType.encryptType == 1) setBinary(getGuomiBinary());
        return deployAsync(StringTool.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "", initialWeiValue);
    }

    public static StringTool load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return new StringTool(contractAddress, web3j, credentials, gasPrice, gasLimit, false);
    }

    public static StringTool load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new StringTool(contractAddress, web3j, transactionManager, gasPrice, gasLimit, false);
    }

    public static StringTool loadByName(String contractName, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return new StringTool(contractName, web3j, credentials, gasPrice, gasLimit, true);
    }

    public static StringTool loadByName(String contractName, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new StringTool(contractName, web3j, transactionManager, gasPrice, gasLimit, true);
    }

    public static void setBinary(String binary) {
        BINARY = binary;
    }

    public static String getGuomiBinary() {
        return GUOMI_BINARY;
    }
}
